﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using myschoolDal;

namespace school
{
    public partial class manchangepassword : Form
    {
        private string oldPassword;
        private string newPassword;
        private string newPassword1;
        public manchangepassword()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox2.Text == "" || textBox3.Text == "" || textBox5.Text == "")
            {
                MessageBox.Show("错误：" + bug.Class1.worng4001, "提示");
            }
            else
            {
                oldPassword = textBox2.Text.ToString();
                newPassword = textBox3.Text.ToString();
                newPassword1 = textBox5.Text.ToString();
                if (manserver.GetManInformationPsd(admin.loginId) != oldPassword)
                {
                    MessageBox.Show("错误：" + bug.Class1.worng4004, "提示");
                }
                else if (newPassword != newPassword1)
                {
                    MessageBox.Show("错误：" + bug.Class1.worng4005, "提示");
                }
                else
                {
                    manserver.ManChangePassword(newPassword, admin.loginId);
                }
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
